<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="renderer" content="webkit">
    <title>欢迎使用支付宝红包进行付款</title>
    <link th:href="@{/css/usdt.css}" rel="stylesheet"/>
    <style>
        .icon {
            position: relative;
            width: 210px;
            height: 210px;
        }

        .icon-alipay {
            width: 30px;
            height: 30px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin-left: -15px;
            margin-top: -15px;
        }

        .blue {
            color: blue;
            margin: 0;
        }

        .green {
            color: green;
            margin: 0;
        }

        .btn-danger {
            color: #fff;
            background-color: #ff3547 !important;
        }

        .btn {
            margin: .375rem;
            color: #fff;
            text-transform: uppercase;
            word-wrap: break-word;
            white-space: normal;
            cursor: pointer;
            border: 0;
            border-radius: .125rem;
            box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .16), 0 2px 10px 0 rgba(0, 0, 0, .12);
            transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
            padding: .84rem 2.14rem;
            font-size: 1.21rem;
        }

        .waves-effect {
            position: relative;
            overflow: hidden;
            cursor: pointer;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        .btn-danger {
            line-height: 2.3;
            min-width: 290px;
            color: #fff;
            background-color: #dc3545;
            border-color: #dc3545;
            font-weight: 800;
            letter-spacing: 3px;
        }


        .form-control:focus {
            color: #495057;
            background-color: #fff;
            border-color: #dc3545;
            outline: 0;
            box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.51);
        }


        textarea.form-control {
            height: auto;
        }

        .form-control {
            display: block;
            width: 100%;
            padding: .375rem .75rem;
            font-size: 1rem;
            font-weight: 400;
            line-height: 1.5;
            color: #495057;
            background-color: #fff;
            background-clip: padding-box;
            border: 1px solid #ced4da;
            border-radius: .25rem;
            transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
        }

        textarea {
            overflow: auto;
        }

        .btn-save {
            line-height: 2.3;
            min-width: 250px;

            background-color: #4dbd74;
            border-color: #4dbd74;
            font-weight: 800;
            letter-spacing: 1px;
            color: #fff;
        }

        .btn {
            color: #fff !important;
        }
    </style>
    <meta name="__hash__" content="839b3037b3d5ce41f10a15df65d144d6_a63a95bcccd2b83bb58e06f6e5fde171"/>
</head>
<script type="text/javascript" src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>

<body>
<div class="container">
    <div class="header">
        <div class="logo bank"
             style="padding-left:10px;font-weight:800;font-size:20px;color:#000;width:600px;float:left"><img
                src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1564807323415&di=a27874288d85d1f20ec2c68dfac2dcfe&imgtype=0&src=http%3A%2F%2Fimgup02.iefans.net%2Fiefans%2F2018-12%2F14%2F10%2F15447556537899_1.jpg" width="37"> 欢迎使用支付宝红包进行付款
        </div>
    </div>
    <div id="qrcode"></div>
    <div class="mainbody">
        <div class="new-1">
            <div>
                <span style="font-weight: bold;font-size: 46px;color:red;" th:text="${channelOrder.amount}"></span> 元
                <div>
                    <div>
                        <!--span style="font-weight: bold;font-size: 14px;color:red;">请严格按此金额付款，多一分或少一分都不到账</span-->
                        <div class="last-time" style="font-size:10px;">
                            <p>
                                支付倒计时：
                                <span id="min">00</span>分
                                <span id="second">00</span>秒
                            </p>
                        </div>
                        <div class="last-time" style="font-size:13px;">
                            订单编号：<span th:text="${channelOrder.childOrderno}"></span>
                        </div>
                        <div class="step2-2" style="background-color:#fff;font-size:16px; ">
                            <div style="margin:0 auto;text-align:center;">
                                <button type="button" class="btn btn-danger" onclick="hbpay()">点击唤起支付宝进行付款</button>
                            </div>
                                <div class="form-group" style="padding:22px;" id="aaa">
                                    <div style="color: blue;cursor: pointer; text-decoration: blue" onclick="openVidio()">点此查看付款引导视频</div>
                                    <label
                                           class="active">付完款后还需要在下面粘贴支付宝的红包吱口令，然后点保存</label>
                                    <textarea class="form-control" id="memo" name='memo' rows="4"
                                              required="required" placeholder="把口令粘贴在这里,口令格式如下：长按复制此条消息，去支付宝首页进行搜索9Tju5MT39eM"></textarea>
                                    <div style="padding-top:12px;">
                                        <button class="btn btn-save" id="mySjlSubmit" onclick="doConfirm()">粘贴完成后点此保存</button>
                                    </div>
                                </div>
                            <div style="margin:0 auto;text-align:center;padding-top:6px;">
                                <img th:src="@{/img/hongbao.jpg}"  style="width:100%">
                            </div>
                        </div>
                    </div>
                    <div class="warning hidden"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function openVidio() {
        layer.open({
            type:2,
            area: ['100vw', '90vh'],
            offset: ['0px', '0px'],
            btn: ['关闭'],
            content: 'https://leit.cdn.bcebos.com/demo.mp4"'
        });
    }
    // 第三种 通过方法响应点击事件
    function hbpay() {
        var remark = '[[${channelOrder.ptOrderno}]]';
        var amount = '[[${channelOrder.amount}]]';
        location.href = "alipays://platformapi/startapp?appId=88886666&target=personal&schemaMode=portalInside&prevBiz=chat&entryMode=personalStage&&remark="+remark+"&amount="+amount;
    }
</script>

<script  th:inline="javascript">
    var time = [[${time}]];
    time = parseInt(time / 1000);

    function getClockString(str) {
        if (str < 10) {
            return '0' + str;
        }
        return str;
    }

    function clock() {
        var min = getClockString(parseInt(time / 60));
        var second = getClockString(parseInt(time % 60));
        document.getElementById("min").innerHTML = (min);
        document.getElementById("second").innerHTML = (second);
        if (min <= 0 && second <= 0) {
            return;
        }
        time--;
        setTimeout(function () {
            clock()
        }, 1000);
    }

    clock();
    // 定时器
    var interval2 = window.setInterval(function () {
        var orderId = [[${channelOrder.orderId}]];
        var url = "../orderStatus/" + orderId;
        $.get(url, function (data) {
            if (data.data.successTime) {
                window.clearInterval(interval2);
                $('#qrcode').html('<div style="color: red;font-size: 25px;">支付成功,切勿重复支付!</div>')
            } else if (data.data.orderStatus == '4') {
                window.clearInterval(interval2);
                $('#qrcode').html('<div style="color: red;font-size: 25px;">订单超时,切勿付款!</div>')
            }
        })
    }, 5000)
    function doConfirm() {
        var memo =  $("#memo").val();
        if(memo.length < 4){
            layer.alert("请黏贴吱口令！", {icon: 5});
            return;
        }
        var id = [[${channelOrder.orderId}]];
        $.ajax({
            type: "post",
            url: "/pay/redPackage",
            data: {
                memo: $("#memo").val(),
                orderId:id
            },
            success: function (r) {
                if(r.code == 0){
                    $('#aaa').html('')
                }
                layer.alert(r.msg, {icon: 6});
            }
        });
    }
</script>
<script>
    function chargeid() {
        var x, text;
        x = document.login.name.value;
        // 如果输入的值 x 不是数字或者小于 1 或者大于 10，则提示错误 Not a Number or less than one or greater than 10
        if (x.length < 4) {
            text = "吱口令不完整，请粘贴完整信息 \n   出错的话可于支付宝首页/更多-红包-红包记录-我发出的 \n找到记录,重新获取吱口令"
            alert(text);
            // document.getElementById("charge1").innerHTML = text;
            return false;//
        } else {
            text = "粘贴完成，即将提交";
            //  document.getElementById("charge1").innerHTML = text;
            return true;
        }
    }
</script>

<script>
    function copy_txt(id) {
        var clipboard = new ClipboardJS('.' + id);
        clipboard.on('success', function (e) {
            layer.msg('复制成功');
            e.clearSelection();
        });
        clipboard.on('error', function (e) {
            layer.alert('复制失败，请手动复制', {icon: 5});
        });
    }
</script>

</body>
</html>